<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}

$subjectid=empty($_GET['id'])?0:(int)$_GET['id'];
if(empty($subjectid)){
    echo "没有选择调查问卷。";
    exit;
}

$row=$ezhand->select("vote_subject",'*','subjectid='.$subjectid);
if(empty($row)){
    echo "没有选择调查问卷！";
    exit;
}

$itemrow=$ezhand->select_all("vote_option_item",'*','subjectid='.$subjectid.' order by listorder asc,id asc');

while(list($k,$v)=each($itemrow)){
  $itemid=$v["id"];
  $itemrow1=$ezhand->select_all("vote_option",'*','subjectid='.$subjectid.' and itemid='.$itemid.' order by optionid asc');  
  $ilist=array();
  if(!empty($itemrow1)){
    $i=0;
    while(list($k2,$v2)=each($itemrow1)){
        $ilist[$i]["optionid"]=$v2["optionid"];
        $ilist[$i]["option"]=$v2["option"];
        $i++;    
    }
  }
  $itemrow[$k]["options"]=$ilist;
    
}
reset($itemrow);

?>